$(function () {
    var myChart = echarts.init(document.getElementById('main'));
    $.get('/number').done(function (data) {
        let parse = JSON.parse(data);
        myChart.setOption({
            title: {
                text: '预约人数统计'
            },
            tooltip: {},
            legend: {
                data:['每月预约人数']
            },
            xAxis: {
                data: parse.month
            },
            yAxis: {},
            series: [{
                name: '每月预约人数',
                type: 'bar',
                data: parse.count
            }]
        });
    });


    var myChart1 = echarts.init(document.getElementById('main1'));
    $.get("/getSituationNumber").done(function (data) {
        let parse = JSON.parse(data);
        var option;
        option = {
            title: {
                text: '接种情况',
                left: 'center'
            },
            tooltip: {
                trigger: 'item'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
            },
            series: [
                {
                    name: '比例',
                    type: 'pie',
                    radius: '60%',
                    data: [
                        {value: parse.abnormal, name: '异常'},
                        {value: parse.normal, name: '正常'},
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        option && myChart1.setOption(option);
    })
})
